#ifndef _MSGTYPES_H_
#define _MSGTYPES_H_

#include "Common/Queue.h"

enum {
	MSG_TO_NONE		=	0x00,		// client -> Catelog & Gate
	MSG_TO_CATALOG	=	0x01,		// -> CatalogServer
	MSG_TO_GATE		=	0x02,		// -> GateServer
	MSG_TO_LOGIC	=	0x03,		// -> LogicServer
	MSG_TO_DB		=	0x04,		// -> DBServer
	MSG_TO_ROUTER	=	0x05,		// -> RouterServer
};

struct MsgHdr
{
	MsgHdr() { memset( this, 0x00, sizeof( MsgHdr ) ); }
	MsgHdr( UInt16 len_, UInt16 cmd_, UInt8 loc_, UInt64 pid_ = 0 )
		: _len( len_ ), _magic( 0 ), _cmd( cmd_ ), _loc( loc_ ), _session( -1 ), _pid( pid_ ) {}
	MsgHdr( UInt16 len_, UInt16 cmd_, UInt8 loc_, Int32 session_, UInt64 pid_ = 0 )
		: _len( len_ ), _magic( 0 ), _cmd( cmd_ ), _loc( loc_ ), _session( session_ ), _pid( pid_ ) {}

	UInt16 _len;
	UInt16 _magic;
	UInt16 _cmd;
	UInt8  _loc;
	Int32  _session;
	UInt64 _pid;
};

typedef Queue<MsgHdr*>	MsgQueue;

#endif // _MSGTYPES_H_